#ifndef UPDATE_MANAGER_LOG_INCLUDE
#define UPDATE_MANAGER_LOG_INCLUDE

#include <windows.h>
#include <string>
#include <stdio.h>

#define LV_NULL		 0
#define LV_FORCE     1
#define LV_ERROR     2
#define LV_WARNING   3
#define LV_INFO      4
#define LV_DEBUG     5

class tLog
{
protected:
	HANDLE m_LogFile;
	std::wstring m_LogFileName;
	DWORD m_LayoutFlag;
	DWORD m_level;
	TCHAR leveltext[6][20];
public:
	tLog();
	virtual ~tLog();

	int Open(std::wstring filename, DWORD layout, DWORD level);
	void Log(DWORD level, const TCHAR * LogText);
	void Close();
};

#define LOGSTR(c,l,x)\
{\
	(c).Log(l,_T(x));\
}

#define LOGSTR1(c,l,x,v) \
{\
	TCHAR debugstr[1024];\
	_stprintf_s(debugstr, _T(x), v);\
	(c).Log(l,debugstr);	\
}

#define LOGSTR2(c,l,x, v1, v2)\
{\
	TCHAR debugstr[1024];\
	_stprintf_s(debugstr, _T(x), v1, v2);\
	(c).Log(l,debugstr);\
}

#define LOGSTR3(c, l, x, v1, v2, v3)\
{\
	TCHAR debugstr[1024];\
	_stprintf_s(debugstr, _T(x), v1, v2, v3);\
	(c).Log(l,debugstr);		 \
}

#define LOGSTR4(c, l, x, v1, v2, v3, v4)		\
{\
	TCHAR debugstr[1024];\
	_stprintf_s(debugstr, _T(x), v1, v2, v3, v4);\
	(c).Log(l,debugstr);		     \
}

#define LOGSTR5(c, l, x, v1, v2, v3, v4, v5)	\
{\
	TCHAR debugstr[1024];\
	_stprintf_s(debugstr, _T(x), v1, v2, v3, v4, v5);\
	(c).Log(l,debugstr);			 \
}
#endif